<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TestFastAPI</title>
    <link rel="stylesheet" href="{{ url_for('statics', path='/test.css') }}" >
    <link rel="icon" href="{{ url_for('statics', path='/favicon.ico') }}">
</head>
<body>
    <h1>dropbox</h1>
    <hr>
    <form>
      <input type="text" name="login" placeholder="请输入你的登录名">
      <input type="password" name="password" placeholder="请输入你的密码">
      <input type="submit" value="提交">
      <input type="submit" value="注册">
    </form>
    <hr>
    <h1>upload file</h1>
    <form action="{{ url_for('upload_file') }}" method="POST" enctype="multipart/form-data">
      <label for ="file">选择文件
      <input type="file" name="file">
      </label>
      <input type="text" name="code" placeholder="请输入分享码">
      <input type="submit" value="上传">
    </form>
    <h1>all files here</h1>
    <div>
        {% for file in files %}
        <ul>
          <li>
            <div>文件名：{{ file.file_name }}</div>
            <div>文件大小：{{ file.file_size }}</div>  
            <div>上传时间：{{ file.upload_time }}</div>  
            <div>文件类型：{{ file.content_type }}</div>
            <div>分享码：{{ file.share_code }}</div>
            <div>下载：
              <div>
                <form action="{{ url_for('download_file')}}?unique_name={{ file.unique_name }}" method="POST">
                  <label for="share_code">分享码
                  <input type="text" name="share_code" placeholder="请输入分享码" >
                  <input type="submit" value="下载">
                  </label>
                </form>
              </div>
            </div>
          </li>
        </ul>
        {% endfor %}
      </div>

</body>
</html>